package edu.njit.hz278.core.web;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 
 * @author Rivers Zhang
 *
 */
public class JSONPWriter implements Writer {

	@Override
	public void write(HttpServletRequest req, HttpServletResponse resp,
			Object... args) throws IOException {
		assert args.length >= 1;
		resp.setContentType("text/javascript");
		JSONMapper.writeJSONP(resp.getOutputStream(), args[0],
				req.getParameter("cb"));
	}

}
